package com.my12306.common.util.quartz.scheduler;

import com.my12306.common.model.po.ScheduleJobPo;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 适配器，用于适配对应的调度类
 *
 * @Author:苏牧夕
 * @Date:2020/5/29 2:45
 * @Version 1.0
 */
@Component
public class SchedulerAdapter {
    public void addJob(BaseScheduler baseScheduler, Scheduler scheduler, ScheduleJobPo scheduleJobPo, JobKey jobKey, TriggerKey triggerKey) throws SchedulerException {
        baseScheduler.addJob(scheduler, scheduleJobPo, jobKey, triggerKey);
    }

    public void updateJob(BaseScheduler baseScheduler, Scheduler scheduler, ScheduleJobPo scheduleJobPo, TriggerKey triggerKey) throws SchedulerException {
        baseScheduler.updateJob(scheduler, scheduleJobPo, triggerKey);
    }


    public void pauseJob(BaseScheduler baseScheduler, Scheduler scheduler, JobKey jobKey) {
        baseScheduler.pauseJob(scheduler, jobKey);
    }


    public void pauseAllJob(BaseScheduler baseScheduler, Scheduler scheduler) {
        baseScheduler.pauseAllJob(scheduler);
    }


    public void resumeJob(BaseScheduler baseScheduler, Scheduler scheduler, JobKey jobKey) {
        baseScheduler.resumeJob(scheduler, jobKey);
    }


    public void resumeAllJob(BaseScheduler baseScheduler, Scheduler scheduler) {
        baseScheduler.resumeAllJob(scheduler);
    }


    public void deleteJob(BaseScheduler baseScheduler, Scheduler scheduler, JobKey jobKey, TriggerKey triggerKey) {
        baseScheduler.deleteJob(scheduler, jobKey, triggerKey);
    }

    public void deleteAllJob(BaseScheduler baseScheduler, Scheduler scheduler, List<JobKey> jobKeys) {
        baseScheduler.deleteAllJob(scheduler, jobKeys);
    }

}
